package com.droowa.model.dao;

import java.sql.SQLException;
import java.util.Date;
import java.util.HashMap;
import java.util.List;

import org.mybatis.spring.SqlSessionTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import com.droowa.domain.CancelManagement;

@Repository
public class CancelManagementDAOMybatisImpl implements CancelManagementDAO{

	@Autowired
	private SqlSessionTemplate session;

	public int insertCancelManagement(CancelManagement cancelManagement)throws SQLException {
		return session.insert(makeSqlId("insertCancelManagement"),cancelManagement);
	}

	public int updateCancelManagement(CancelManagement cancelManagement)throws SQLException {
		return session.update(makeSqlId("updateCancelManagement"), cancelManagement);
	}

	public int deleteCancelManagement(String orderNumber) throws SQLException {
		return session.delete(makeSqlId("deleteCancelManagement"), orderNumber);
	}

	@Override
	public List<CancelManagement> selectCancelManagementByAll(HashMap map)throws SQLException {
		System.out.println(map);
		return session.selectList(makeSqlId("selectCancelManagementByAll"),map);
	}



	private String makeSqlId(String id){
		return "droowa.CancelManagement."+id;
	}
}
